package Text18;

import java.io.*;
import java.util.Arrays;

public class Main {
    //第一行包含三个整数 N,D,K。以下 N行每行一条日志，包含两个整数 ts和 id。
    static int N = 100010;

    static PII[] piis = new PII[N];
    static int[] cnt = new int[N];
    static boolean[] st = new boolean[N];

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String s1[] = br.readLine().split(" ");
        int n = Integer.parseInt(s1[0]);
        int d = Integer.parseInt(s1[1]);
        int k = Integer.parseInt(s1[2]);
        for (int i = 0; i < n; i++) {
            String s2[] = br.readLine().split(" ");
            piis[i] = new PII(Integer.parseInt(s2[0]), Integer.parseInt(s2[1]));
        }
        Arrays.sort(piis, 0, n);
        for (int i = 0, j = 0; i < n; i++) {
            int id = piis[i].id;
            cnt[id]++;
            while (piis[i].ts - piis[j].ts >= d) {
                cnt[piis[j].id]--;
                j++;
            }
            if (cnt[id] >= k){
                st[id]=true;
            }
        }
        for (int i = 0; i < N - 10; i++) {
            if(st[i]){
                System.out.println(i);
            }
        }
    }
}

class PII implements Comparable<PII> {
    int ts, id;

    public PII(int ts, int id) {
        this.ts = ts;
        this.id = id;
    }

    @Override
    public int compareTo(PII o) {
        return Integer.compare(this.ts,o.ts);
    }
}

